<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<title>添加商品类型</title>
	<hdjs/>
	<js file="__CONTROL_TPL__/js/js.js">
	<js file="__CONTROL_TPL__/js/addSpec.js">
</head>
<body>
	<div class="menu_list">
		<ul>
			<li><a href="{|U:'index'}">商品列表</a></li>
			<li><a href="{|U:'add'}"  class="action">添加商品</a></li>
		</ul>
	</div>
	<div class="title-header">添加商品</div>
	<div class="tab">
		<ul class="tab_menu">
			<li lab="base">
				<a> 基本参数</a>
			</li>
			<li lab="content" class="action">
				<a>内容</a>
			</li>
			<li lab='pic'>
				<a>图片</a>
			</li>
		</ul>
		<form action="" class="hd-form" method="post" enctype="multipart/form-data">
			<input type="hidden" name="cname" value="{$data['cname']}">
			<input type="hidden" name="gtname" value="{$goodsType[$data['gtid']]['gtname']}">
			<input type="hidden" name="gtid" value="{$data['gtid']}">
			<input type="hidden" name="cid" value="{$data['cid']}">

			<!-- <list from="$attrSpecForm" name="stid">
				<input type="hidden" name="stid[]" value="{$stid.stid}">
			</list> -->
			<div class="tab_content">
				<div id="base">
					<table class="table1">
						<tr>
							<th class="w100"> 商品名称 </th>
							<td >
								<input type="text" name="gname" class="w500" value="{$data.gname}"/>
							</td>
						</tr>
						<tr>
							<th>栏目</th>
							<td>{$data['cname']}</td>
						</tr>
						<tr>
							<th>商品类型</th>
							<td>{$goodsType[$data['gtid']]['gtname']}</td>
						</tr>
						<tr>
							<th>属性</th>
							<td>
								<table>
									<list from="$attrForm" name="n">
										<tr>
											<th>{$n.attr_name}</th>
											<td>{$n.html}</td>
										</tr>
									</list>
								</table>
							</td>
						</tr>
						<if value="!empty($attrSpecForm)">
						<tr>
							<th>规格</th>
							<td>
								<table id="GuiGe">
										
											<list from="$attrSpecForm" name="spec" row='1'>
											<tr class="title-header">
												<list from="$spec.html" name="web">
													<td>{$web.attr_name}</td>
												</list>
												<td class="w50">价格</td>
												<td class="w50">库存</td>
												<td class="w50">货号</td>
												<td class="w150">样图</td>
												<td class="w150"><a onclick="addSpec(this)" cursor="pointer" href="javascript:">添加规格</a></td>
												<td class="w100">替换样图</td>
											</tr>
											</list>
											
										
										
											<list from="$attrSpecForm" name="spec">
												<tr class="gg">
												<list from="$spec.html" name="web">
													<td>{$web.web}</td>
												</list>
												<td><input type="text" class='ggPrice' name="spec[price][]" id="" value="{$spec.price}"></td>
												<td><input type="text" class='ggStock' name="spec[stock][]" id="" value="{$spec.stock}"></td>
												<td><input type="text" name="spec[goods_sn][]" id="" value="{$spec.goods_sn}"></td>
												
												<td><img src="__ROOT__/{$spec['small']}" alt="" style="width:50px;height:50px;"></td>
												<td ><a onclick="delStockData(this)" stid="{$spec.stid}" cursor="pointer" href="javascript:">删除规格</a></td>
												<td ><input type="file" name="pics[]"/></td>
												<td><input type="hidden" name="spec[stid][]" value="{$spec.stid}"></td>
												<td id="spec_pic"><input type="hidden" name="spec[stock_pic][]" value="{$spec.stock_pic}"></td>
												<td id="spec_picid"><input type="hidden" name="spec[pic_id][]" value="{$spec.pic_id}"></td>
												</tr>
											</list>
											<!-- <td><input type="text" name="spec[price][]" id=""></td>
											<td><input type="text" name="spec[stock][]" id=""></td>
											<td><input type="text" name="spec[goods_sn][]" id=""></td> -->
								</table>
							</td>
							
						</tr>		
						</if>
						<tr>
							<th> 最低价 </th>
							<td>
								<input type="text" name="price" class="w400" value="{$data.price}"/>
							</td>
						</tr>
						<tr>
							<th> 总库存 </th>
							<td>
								<input type="text" name="stock" class="w400" value="{$data.stock}"/>
							</td>
						</tr>
						<tr>
							<th> 关键字 </th>
							<td>
								<input type="text" name="keywords" class="w400" value="{$data.k}"/>
							</td>
						</tr>
						<tr>
							<th> 描述 </th>
							<td>
								<textarea name="description" id="" cols="30" rows="10" class="w400 h100">{$data.dsc}</textarea>
							</td>
						</tr>
						
						<tr>
							<th> 录入时间 </th>
							<td>
								<input type="text" name="addtime" id="addtime" readonly="readonly" value="{|date:'Y/m/d h:i:s'}"/>
							</td>
							<script>
								
									$('#addtime').calendar({format:'yyyy/MM/dd HH:mm:ss'});
								
							</script>
							
						</tr>
						
						<tr>
							<th> 服务 </th>
							<td>
								<input type="text" name="service" value="{$data.service}"/>
							</td>
						</tr>
						<tr>
							<th> 点击量 </th>
							<td>
								<input type="text" name="click" value="{$data.click}"/>
							</td>
						</tr>
					</table>
				</div>
				<div id="content">
					<table class="table1">
						<tr>
							<th class="w100">内容</th>
							<td>
								<ueditor name="body"  content="{$data.body}"/>
							</td>
						</tr>
						
					</table>
				</div>

				<div id="pic">
					<table class="table1">
						<tr>
							<th class="w100">产品主图</th>
							<td>
								<input type="file" name="index_pic"/>
							</td>
							<td><img src="__ROOT__/{$data.index_pic}" alt="" class="w100"></td>
							<input type="hidden" name="in_pic" id="" value="{$data.index_pic}">
						</tr>
						<tr>
							<th> 列表页图 </th>
							<td>
								<input type="file" name="list_pic"/>
							</td>
							<td><img src="__ROOT__/{$data.list_pic}" alt="" class="w100"></td>
							<input type="hidden" name="li_pic" id="" value="{$data.list_pic}">
						</tr>

						<tr>
							<th> 内容页图 </th>

							<td>
								<ul id="old_cpics" style="width:700px;">
									<list from="$pics" name="pic">
										<li style="float:left;margin-right:10px;position:relative;">
											<img src="__ROOT__/{$pic.small}" alt="" class="w150">
											<span id="spandelpic" onclick="delold(this)" picid="{$pic.pic_id}" style="border:1px solid #333;text-align:center;font-wigth:700;cursor:pointer;display:block;width:15px;height:20px;line-height:20px;background:#fff;position:absolute;top:3px;right:5px;z-index:5px;">X</span>

										</li>
									</list>
								</ul>
								<div style="clear:both;">
								<input type="file" name="pics[]"/>
								<button class="hd-cancel" type="button" onclick="addPics();">添加</button></div>

								<ul id="content_pic" style="margin-top:5px;">

								</ul>
							</td>
							
						</tr>

						
					</table>
				</div>
			</div>
			<input type="submit" value="添加" name="submit" class="hd-success position-bottom" style="margin-left:30px;">

		</form>
	</div>
		
	<script>
		validate:{
			$(function(){
				$('form').validate({
					gname:{
						rule:{
							required:true
						},
						error:{
							required:'商品名不能为空'
						}
					}
					
				})
			})
		}
	</script>
</body>
</html>